Skip to content

feat: calculate taskbar position and display on top of it #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ibetitsmike
Copy link
Contributor

@ibetitsmike ibetitsmike commented Jun 11, 2025

Closes: #119

@ibetitsmike ibetitsmike requested a review from deansheather June 11, 2025 13:53
@ethanndickson
Copy link
Member

ethanndickson commented Jun 13, 2025

Does this account for opening it from the tray overflow? e.g. from:
i

EDIT: The Logitech app I use does this actually, I don't think I like it
image

What are the downsides of doing it on the cursor position?

Copy link
Contributor Author

My idea was to actually draw it from the taskbar because otherwise it just leaves the tray window floating on your desktop. I clicked this one from the expanded overflow and it painted like this:

image.png


// Adjust if the window goes off the right edge of the display.
if (x + width > workArea.X + workArea.Width) x = workArea.X + workArea.Width - width;
int x, y;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous calculations had some hardcoded plus or minus 10 as a padding, shouldn't we do something similar to avoid it directly touching the taskbar or the side of the screen?

Comment on lines +263 to +272
case TaskbarPosition.Bottom when tb.AutoHide:
// Auto-hide bottom bar sits under the workArea – use workArea, not bounds.
x = workArea.X + workArea.Width - panelSize.Width;
y = workArea.Y + workArea.Height - panelSize.Height - tb.Gap;
break;

// Adjust if the window goes off the top edge of the display (somehow).
if (y < workArea.Y) y = workArea.Y;
default: // right or bottom when not auto-hiding
x = workArea.X + workArea.Width - panelSize.Width;
y = bounds.Y + bounds.Height - panelSize.Height - tb.Gap;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why we wouldn't just always use workArea.Height here, the comment doesn't do a very good job explaining why we wouldn't prefer to always use the workArea.Height.

@@ -338,4 +317,70 @@ public struct POINT
public int Y;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the logic for drawing the tray window
3 participants